version			14.1
clear			all
set				more off

/* THE FILE GENERATES FIGURE I PANEL A-B OF WASEEM (2019) RESTAT */

matrix 			input tax_rates=(0.5 ,1   ,   2,  3,  4,  5,7.5,10 ,12.5,15,19,21  ,  25, 0, 0, 0  ,    0,   0, 0, 0\						///
								 0.25,0.5 ,0.75,1.5,2.5,3.5,4.5,6  , 7.5, 9,10,11  ,12.5,14,15,16  , 17.5,18.5,19,20\						///	
								 0.5 ,0.75,1.5 ,2.5,3.5,4.5,6  ,7.5,   9,10,11,12.5,	 14,15,16,17.5,	18.5,  19,20, 0\						///
								 7.5 ,10  ,  15,20 , 25,0  ,0  ,0  ,0   ,0 , 0,   0,   0, 0, 0,   0,    0,   0, 0, 0)

set				obs 5000
g				taxableinc=_n/10
expand			6
sort			taxableinc
egen			year=fill(2006 2007 2008 2009 2010 2011 2006 2007 2008 2009 2010 2011)
g				tau=0
local 			i=1
foreach 		z in 100 110 125 150 175 200 300 400 500 600 800 1000 1300 { 
					replace tau=tax_rates[1,`i'] if taxableinc > (`z') & (year==2006 | year==2007 |year==2008 |year==2009) 
					local i=`i'+1
}
local 			i=1
foreach 		z in 300 500 750 1000 1500  { 
					replace tau=tax_rates[4,`i'] if taxableinc > (`z') & (year==2010 | year==2011) 
					local i=`i'+1
}
replace 		tau=0 if taxableinc<=350 & year==2011 
replace 		tau=. if taxableinc==.
replace 		tau=0 if taxableinc<=0
replace			tau=tau/100
reshape 		wide tau, i(taxableinc) j(year)
forvalues		y=2009/2010 {
				local fy=`y'+1
				local m=substr("`fy'",3,2)
				g delnetoft`m'=(((1-tau`fy')-(1-tau`y'))/(1-tau`y'))*100
}

/* 2010 */

g				low10=0
g				high10=delnetoft10 if taxableinc>100 & taxableinc<=300

#d				;
twoway  		(rarea low10 high10 taxableinc if taxableinc>100 & taxableinc<=300, sort color(ltblue) legend(off))
				(line  delnetoft10 taxableinc,sort clcolor(maroon) mcolor(maroon) msymbol(O) lwidth(thick) legend(off)),
				xtitle(Taxable Income in PKR 000s) xtitle(, alignment(top))
				xlabel(0(50)500)
				ytitle(Change in Net-of-tax Rate (%)) yscale(titlegap(*10))
				ylabel(0(2)8)
				graphregion(fcolor(white) style(none) color(white) margin(0 2 0 2)) bgcolor(white);
graph 			export "$project_graph\FigureIPanelA.eps", replace;
#d 				cr

/* 2011 */

g				low11=0
g				high11=delnetoft11 if taxableinc>300 & taxableinc<=350

#d				;
twoway  		(rarea low11 high11 taxableinc if taxableinc>300 & taxableinc<=350, sort color(ltblue) legend(off))
				(line  delnetoft11 taxableinc,sort clcolor(maroon) mcolor(maroon) msymbol(O) lwidth(thick) legend(off)),
				xtitle(Taxable Income in PKR 000s) xtitle(, alignment(top))
				xlabel(0(50)500)
				ytitle(Change in Net-of-tax Rate (%)) yscale(titlegap(*10))
				ylabel(0(2)8)
				graphregion(fcolor(white) style(none) color(white) margin(0 2 0 2)) bgcolor(white);
graph 			export "$project_graph\FigureIPanelB.eps", replace;
#d 				cr
